package com.carpedil.common.socket;

import com.alibaba.fastjson.JSON;
import com.carpedil.common.dto.OrderDTO;

import javax.websocket.DecodeException;
import javax.websocket.Decoder;
import javax.websocket.EndpointConfig;

/** @author Administrator */
public class OrderDecoder implements Decoder.Text<OrderDTO> {

  @Override
  public OrderDTO decode(String dto) throws DecodeException {
    return JSON.parseObject(dto, OrderDTO.class);
  }

  @Override
  public boolean willDecode(String s) {
    return false;
  }

  @Override
  public void init(EndpointConfig endpointConfig) {}

  @Override
  public void destroy() {}
}
